#ifndef QSTATISTICGRAPH_H
#define QSTATISTICGRAPH_H

#include <QtGui>

/**
	@author Stefan Weigert <weigert.stefan@gmail.com>
*/
class QStatisticGraph : public QGraphicsItem
{
	public:
		QStatisticGraph ( QColor color, QString labelString );

		~QStatisticGraph();

		void setPen ( const QPen & pen );
		void setBrush ( const QBrush & brush );
		QRectF boundingRect() const;
		void advance ( int phase );
		void paint ( QPainter* painter, const QStyleOptionGraphicsItem* option = 0, QWidget* widget = 0 );

		void insertPoint ( QPointF point );
		void reset();

	private:
		int currentIndex;
		int labelX;

		float minY, maxY;

		QString labelString;

		QVector<QPointF> points;
		QPolygonF newPoints;
		QPolygonF oldPoints;

		QPen pen;
		QBrush brush;
		QRectF rect;
};

#endif
